/*

通过反射调用函数
 */

package main

import (
	"fmt"
	"reflect"
)

type Ref struct {
	key string
	val string
}

func (this *Ref) SayHi(str interface{}) {
	fmt.Println("reflect say:", str)
}

func main() {
	ref := &Ref{key: "hi", val: "girl"}
	iref := reflect.ValueOf(ref)
	fn := iref.MethodByName("SayHi")
	var str = "hello reflect222"
	var in []reflect.Value
	in = append(in, reflect.ValueOf(str))
	fn.Call(in)
}